26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
233 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
234 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
243 Attribute(0), CallingOnSet(false), Length01(
Track->DefaultTrackLength), Length23(-1), SpeedLimit01(
Track->DefaultTrackSpeedLimit), SpeedLimit23(-1),
244 TrainIDOnElement(-1), TrainIDOnBridgeTrackPos01(-1), TrainIDOnBridgeTrackPos23(-1), StationEntryStopLinkPos1(-1), StationEntryStopLinkPos2(-1),
245 SigAspect(FourAspect)
247 for(
int x = 0; x < 4; x++)
263 if(lower.second < higher.second)
267 else if(lower.second > higher.second)
271 else if(lower.second == higher.second)
273 if(lower.first < higher.first)
286 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
287 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
291 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
302 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
330 {2, 4}, {6, 2}, {8, 6}, {4, 8},
331 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
341 else if(
Link[2] == -1)
354 else if(
Link[2] == -1)
363 for(
int x = 0; x < 16; x++)
365 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
541 throw Exception(
"Error in EntryExitNumber 4");
636 throw Exception(
"Error in EntryExitNumber 5");
733 throw Exception(
"Error in EntryExitNumber 6");
823 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1112 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1136 AnsiString NL =
'\n';
1138 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable; " + NL + NL +
1139 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1140 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1141 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1148 int InternalLinkCheckArray[9][2] =
1149 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1154 for(
int x = 0; x < 9; x++)
1156 for(
int y = 0; y < 2; y++)
1163 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1165 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1166 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1167 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1168 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1169 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1175 int HVArray[10][2] =
1176 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1178 for(
int x = 0; x < 10; x++)
1180 for(
int y = 0; y < 2; y++)
1189 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1192 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1193 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1195 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1196 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1198 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1199 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1202 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1205 for(
int x = 0; x < 40; x++)
1211 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1214 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1215 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1217 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1218 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1220 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1221 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1224 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1227 for(
int x = 0; x < 40; x++)
1233 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1236 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1237 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1239 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1240 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1242 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1243 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1246 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1249 for(
int x = 0; x < 40; x++)
1275 for(
int x = 0; x < 40; x++)
1302 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1303 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1304 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1305 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1306 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1307 {0, 0, 129}, {0, -1, 145},
1310 for(
int x = 0; x < 25; x++)
1312 for(
int y = 0; y < 3; y++)
1320 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1321 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1322 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1323 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1324 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1325 {0, 0, 129}, {0, 1, 145},
1328 for(
int x = 0; x < 25; x++)
1330 for(
int y = 0; y < 3; y++)
1338 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1339 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1340 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1341 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1342 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1343 {0, 0, 130}, {-1, 0, 146},
1346 for(
int x = 0; x < 25; x++)
1348 for(
int y = 0; y < 3; y++)
1356 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1357 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1358 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1359 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1360 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1361 {0, 0, 130}, {1, 0, 146},
1364 for(
int x = 0; x < 25; x++)
1366 for(
int y = 0; y < 3; y++)
1374 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1375 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1376 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1377 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1378 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1379 {0, -1, 129}, {1, 0, 130},
1380 {-1, 0, 130}, {0, 1, 145},
1381 {0, -1, 145}, {1, 0, 146},
1384 for(
int x = 0; x < 28; x++)
1386 for(
int y = 0; y < 3; y++)
1404 for(
int x = 0; x < 8; x++)
1406 for(
int y = 0; y < 3; y++)
1424 for(
int x = 0; x < 8; x++)
1426 for(
int y = 0; y < 3; y++)
1444 for(
int x = 0; x < 8; x++)
1446 for(
int y = 0; y < 3; y++)
1464 for(
int x = 0; x < 8; x++)
1466 for(
int y = 0; y < 3; y++)
1474 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1476 for(
int x = 0; x < 4; x++)
1478 for(
int y = 0; y < 3; y++)
1486 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1487 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1488 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1489 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1495 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1496 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1497 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1498 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1504 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1505 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1506 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1507 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1513 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1514 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1515 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1516 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1538 delete UGMIt->second;
1614 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1615 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1617 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1624 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1625 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1638 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1639 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1641 {4, 6, 2, 8}, {1, 9, 3, 7},
1643 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1645 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1648 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1649 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1650 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1651 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1652 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1653 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1654 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1656 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1657 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1658 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1659 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1660 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1661 {4, 6, -1, -1}, {2, 8, -1, -1},
1663 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1665 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1667 {4, 6, -1, -1}, {2, 8, -1, -1},
1672 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1673 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1674 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1675 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1678 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1679 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1680 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1682 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1683 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1684 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1686 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1688 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1689 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1690 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1691 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1692 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1693 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1694 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1695 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1696 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1697 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1698 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1699 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1700 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1702 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1703 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1704 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1705 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1706 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1707 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1708 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1709 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1713 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1714 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1715 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1721 for(
int x = 0; x < 17; x++)
1723 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1725 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1729 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1735 ExistingGraphicLoaded(false), Width(16), Height(16)
1747 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1785 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1789 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1793 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1797 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1820 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1823 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1827 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1831 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1865 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1886 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1900 bool TrackPresent =
false;
1914 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1918 TrackPresent =
true;
1923 return(!TrackPresent);
1931 bool TrackPresent =
false;
1940 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1944 TrackPresent =
true;
1950 return(!TrackPresent);
1955 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1958 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1959 TrackEraseSuccessfulFlag =
false;
1964 ErasedTrackVectorPosition = -1;
1965 AnsiString SName =
"", ErrorString;
1967 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1973 TrackMapKeyPair.first = HLocInput;
1974 TrackMapKeyPair.second = VLocInput;
1975 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1986 if(ErrorString !=
"")
1988 throw Exception(ErrorString +
" for EraseTrackElement 1");
2012 ErasedTrackVectorPosition = VecPos;
2013 TrackEraseSuccessfulFlag =
true;
2019 unsigned int VecPos;
2020 InactiveTrackMapKeyPair.first = HLocInput;
2021 InactiveTrackMapKeyPair.second = VLocInput;
2026 VecPos = InactiveTrack2MultiMapIterator->second;
2031 if(ErrorString !=
"")
2033 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2043 TrackEraseSuccessfulFlag =
true;
2064 VecPos = InactiveTrack2MultiMapIterator->second;
2069 if(ErrorString !=
"")
2071 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2095 if(TrackEraseSuccessfulFlag)
2117 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2118 bool PlatAllowedFlag =
false;
2120 TrackLinkingRequiredFlag =
false;
2132 LocationNameEntry.first =
"";
2140 TempTrackElement.
HLoc = HLocInput;
2141 TempTrackElement.
VLoc = VLocInput;
2167 else if(Aspect == 1)
2171 else if(Aspect == 2)
2175 else if(Aspect == 3)
2184 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2187 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2189 if(InactiveFoundFlag)
2193 NonStationOrLevelCrossingPresent =
true;
2197 NonStationOrLevelCrossingPresent =
true;
2201 PlatformPresent =
true;
2212 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2220 PlatAllowedFlag =
true;
2224 PlatAllowedFlag =
true;
2228 PlatAllowedFlag =
true;
2232 PlatAllowedFlag =
true;
2236 TrackLinkingRequiredFlag =
true;
2264 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2265 (!FoundFlag && !InactiveFoundFlag))
2268 TrackLinkingRequiredFlag =
true;
2300 TrackLinkingRequiredFlag =
true;
2312 else if(FoundFlag || InactiveFoundFlag)
2331 bool BothPointFillets =
true;
2346 TrackLinkingRequiredFlag =
true;
2360 bool InternalChecks)
2364 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2365 bool PlatAllowedFlag =
false;
2367 TrackLinkingRequiredFlag =
false;
2370 LocationNameEntry.first =
"";
2376 TempTrackElement.
HLoc = HLocInput;
2377 TempTrackElement.
VLoc = VLocInput;
2378 for(
int x = 0; x < 4; x++)
2384 TempTrackElement.
Conn[x] = -1;
2388 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2399 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2401 if(InactiveFoundFlag)
2405 NonStationOrLevelCrossingPresent =
true;
2409 NonStationOrLevelCrossingPresent =
true;
2413 PlatformPresent =
true;
2424 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2432 PlatAllowedFlag =
true;
2436 PlatAllowedFlag =
true;
2440 PlatAllowedFlag =
true;
2444 PlatAllowedFlag =
true;
2448 TrackLinkingRequiredFlag =
true;
2479 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2480 (!FoundFlag && !InactiveFoundFlag))
2483 TrackLinkingRequiredFlag =
true;
2518 TrackLinkingRequiredFlag =
true;
2530 else if(FoundFlag || InactiveFoundFlag)
2549 bool BothPointFillets =
true;
2564 TrackLinkingRequiredFlag =
true;
2594 ShowMessage(
"Gaps must be set before track can be validated");
2604 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2615 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2632 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2639 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2663 std::pair<AnsiString, char>TempMapPair;
2671 TempMapPair.second =
'x';
2681 AnsiString Name =
"";
2682 typedef std::list<AnsiString> TNoPlatsList;
2683 TNoPlatsList::iterator NPLIt;
2684 TNoPlatsList NoPlatsList;
2685 typedef std::list<AnsiString> TLocNameList;
2686 TLocNameList LocNameList;
2691 LocNameList.push_back(LNMMIt->first);
2694 LocNameList.unique();
2695 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2699 if(MMRange.first == MMRange.second)
2705 if((LNMMIt->second) < 0)
2719 TempIt = MMRange.second;
2720 if(LNMMIt == --TempIt)
2722 NoPlatsList.push_back(Name);
2726 if(!NoPlatsList.empty())
2728 AnsiString NoPlatsAnsiList =
"";
2729 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2731 NoPlatsAnsiList += *NPLIt +
'\n';
2735 if(NoPlatsList.size() > 1)
2737 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2741 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2756 int NewHLoc, NewVLoc;
2757 bool ConnectionFoundFlag, LinkFoundFlag;
2759 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2761 for(
unsigned int y = 0; y < 4; y++)
2779 ConnectionFoundFlag =
false;
2780 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2786 ConnectionFoundFlag =
true;
2788 LinkFoundFlag =
false;
2789 for(
unsigned int a = 0; a < 4; a++)
2793 LinkFoundFlag =
true;
2809 if(!ConnectionFoundFlag)
2884 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2901 bool UnsetGaps =
false;
2908 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2912 for(
unsigned int y = 0; y < 4; y++)
2924 for(
unsigned int y = 0; y < 4; y++)
2934 for(
unsigned int y = 1; y < 4; y++)
2943 for(
unsigned int y = 0; y < 4; y++)
2956 for(
unsigned int y = 0; y < 4; y++)
2984 int NumberOfActiveElements = 0;
2986 GraphicsFollow =
false;
2990 if(MarkerString[MarkerString.Length()] ==
'1')
2992 GraphicsFollow =
true;
2994 for(
int x = 0; x < NumberOfActiveElements; x++)
3000 TrackElement.
HLoc = TempInt;
3002 TrackElement.
VLoc = TempInt;
3008 TrackElement.
Conn[0] = TempInt;
3032 if((TempInt != -1) && (TempInt < 10))
3042 if((TempInt != -1) && (TempInt < 10))
3059 if(Marker[1] ==
'3')
3063 else if(Marker[1] ==
'2')
3067 else if(Marker[1] ==
'G')
3081 int NumberOfInactiveElements = 0;
3085 for(
int x = 0; x < NumberOfInactiveElements; x++)
3091 TrackElement.
HLoc = TempInt;
3093 TrackElement.
VLoc = TempInt;
3099 bool LocError =
false;
3128 for(
int x = 0; x < NumberOfGraphics; x++)
3139 bool FileError =
false;
3141 for(
int x = 0; x < NumberOfGraphics; x++)
3154 UGME.second =
new TPicture;
3155 UGME.second->LoadFromFile(
UGME.first);
3158 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3165 catch(
const EInvalidGraphic &e)
3174 delete UGMIt->second;
3179 catch(
const Exception &e)
3188 delete UGMIt->second;
3196 bool FoundInMap =
false;
3215 UGME.second =
new TPicture;
3216 UGME.second->LoadFromFile(
UGME.first);
3219 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3226 catch(
const EInvalidGraphic &e)
3235 delete UGMIt->second;
3240 catch(
const Exception &e)
3249 delete UGMIt->second;
3274 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3278 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3280 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3283 VecFile << x <<
'\n';
3284 VecFile << TrackElement.
SpeedTag <<
'\n';
3285 VecFile << TrackElement.
HLoc <<
'\n';
3286 VecFile << TrackElement.
VLoc <<
'\n';
3290 VecFile << TrackElement.
Conn[0] <<
'\n';
3294 VecFile << TrackElement.
Attribute <<
'\n';
3300 VecFile << int(1) <<
'\n';
3304 VecFile << int(0) <<
'\n';
3307 VecFile << TrackElement.
Length01 <<
'\n';
3308 VecFile << TrackElement.
Length23 <<
'\n';
3311 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3318 VecFile <<
"3*****" <<
'\0' <<
'\n';
3322 VecFile <<
"2*****" <<
'\0' <<
'\n';
3326 VecFile <<
"G*****" <<
'\0' <<
'\n';
3330 VecFile <<
"4*****" <<
'\0' <<
'\n';
3335 VecFile <<
"******" <<
'\0' <<
'\n';
3340 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3344 VecFile << x <<
'\n';
3345 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3346 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3347 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3348 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3349 VecFile <<
"******" <<
'\0' <<
'\n';
3364 GraphicsFollow =
false;
3366 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3372 AnsiString MarkerString;
3379 if(MarkerString[MarkerString.Length()] ==
'1')
3381 GraphicsFollow =
true;
3383 for(
int x = 0; x < NumberOfActiveElements; x++)
3391 int SpeedTag = TempInt;
3398 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3404 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3409 if((SpeedTag > 87) && (SpeedTag < 96))
3412 if((TempInt < -1) || (TempInt > 3))
3418 if((TempInt < -1) || (TempInt > 999999))
3424 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3425 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3428 if((TempInt < -1) || (TempInt > 5))
3434 if((SpeedTag >= 68) && (SpeedTag <= 75))
3437 if((TempInt != 0) && (TempInt != 1))
3444 if((TempInt < -1) || (TempInt > 999999))
3450 if((TempInt < -1) || (TempInt > 999999))
3456 if((TempInt < -1) || (TempInt > 999999))
3462 if((TempInt < -1) || (TempInt > 999999))
3483 int NumberOfInactiveElements = 0;
3486 if(NumberOfInactiveElements < 0)
3496 for(
int x = 0; x < NumberOfInactiveElements; x++)
3510 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3516 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3543 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3549 AnsiString FileName =
"", TempStr =
"";
3551 for(
int x = 0; x < NumberOfGraphics; x++)
3553 TPicture *TempPicture =
new TPicture;
3562 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3575 catch(
const EInvalidGraphic &e)
3580 for(
int y = x + 1; y < NumberOfGraphics; y++)
3586 ShowMessage(FileName +
3587 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3592 catch(
const Exception &e)
3597 for(
int y = x + 1; y < NumberOfGraphics; y++)
3603 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3604 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3622 for(
int x = 0; x < VecSize; x++)
3645 for(
int x = 0; x < VecSize; x++)
3667 for(
int x = 0; x < VecSize; x++)
3721 for(
int x = 0; x < VecSize; x++)
3779 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3801 if(BothPointFilletsAndBasicLCs)
3876 Bitmap->Canvas->CopyMode = cmSrcCopy;
3878 Graphics::TBitmap *GraphicOutput;
4053 for(
int x = 0; x < 40; x++)
4082 Graphics::TBitmap *GraphicPtr;
4097 Graphics::TBitmap* SignalPlatformGraphic;
4130 if(OldTransparentColour !=
clB5G5R5)
4153 Bitmap->Canvas->CopyMode = cmSrcCopy;
4181 Bitmap->Canvas->CopyMode = cmSrcCopy;
4183 Graphics::TBitmap *GraphicOutput;
4193 if(BaseElement == 1)
4283 for(
int x = 0; x < 40; x++)
4312 Graphics::TBitmap *GraphicPtr;
4327 Graphics::TBitmap* SignalPlatformGraphic;
4388 for(
int x = 0; x < 40; x++)
4396 Graphics::TBitmap* SignalPlatformGraphic;
4417 if(OldTransparentColour !=
clB5G5R5)
4431 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4503 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4517 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4543 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4568 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4598 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4669 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4684 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4713 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4720 throw Exception(
"Error - Map & Vector different sizes");
4722 unsigned int NonZeroCount = 0;
4724 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4733 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4739 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4743 TrackMapEntry.first = TrackMapKeyPair;
4744 TrackMapEntry.second = x;
4745 if(!(
TrackMap.insert(TrackMapEntry).second))
4747 throw Exception(
"Error - map insertion failure, TrackVector in error");
4751 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4753 for(
unsigned int y = 0; y < 4; y++)
4778 THVPair GapMapKeyPair, GapMapValuePair;
4781 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4787 GapMapEntry.first = GapMapKeyPair;
4790 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4794 GapMapEntry.second = GapMapValuePair;
4797 GapMap.insert(GapMapEntry);
4812 bool TrackElementPositionsOK =
true;
4814 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4826 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4827 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4828 "can't connect to an underpass or vice versa)");
4836 for(
unsigned int y = 0; y < 4; y++)
4854 bool ConnectionFoundFlag;
4858 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4864 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4873 if(ConnectionFoundFlag)
4880 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4882 TrackElementPositionsOK =
false;
4887 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4889 TrackElementPositionsOK =
false;
4894 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4898 TrackElementPositionsOK =
false;
4903 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4906 TrackElementPositionsOK =
false;
4910 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4913 TrackElementPositionsOK =
false;
4918 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4919 TrackElementPositionsOK =
false;
4922 if(!TrackElementPositionsOK)
4929 throw Exception(
"Error in track element positions in FinalCall");
4942 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4948 for(
unsigned int y = 0; y < 4; y++)
4970 bool ConnectionFoundFlag;
4971 bool LinkMatchFound =
false;
4974 if(ConnectionFoundFlag)
4976 for(
unsigned int a = 0; a < 4; a++)
4985 LinkMatchFound =
true;
4996 throw Exception(
"Error in final track linkage - - no matching link found");
5009 throw Exception(
"Error in final track linkage - connection not found");
5024 bool ConnErrorFlag =
false;
5026 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5030 ConnErrorFlag =
true;
5034 ConnErrorFlag =
true;
5038 ConnErrorFlag =
true;
5042 ConnErrorFlag =
true;
5050 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5059 throw Exception(
"ConnError in LinkTrack - Final");
5063 throw Exception(
"ConnError in LinkTrack - Precheck");
5066 bool CLkErrorFlag =
false;
5068 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5072 CLkErrorFlag =
true;
5076 CLkErrorFlag =
true;
5080 CLkErrorFlag =
true;
5084 CLkErrorFlag =
true;
5092 throw Exception(
"CLkError in LinkTrack - Final");
5096 throw Exception(
"CLkError in LinkTrack - Precheck");
5101 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5131 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5147 for(
unsigned int y = 0; y < 4; y++)
5166 bool ConnectionFoundFlag;
5172 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5181 if(ConnectionFoundFlag)
5184 bool LinkFoundFlag =
false;
5241 for(
unsigned int a = 0; a < 4; a++)
5250 LinkFoundFlag =
true;
5258 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5268 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5281 bool ConnErrorFlag =
false;
5283 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5287 ConnErrorFlag =
true;
5291 ConnErrorFlag =
true;
5295 ConnErrorFlag =
true;
5299 ConnErrorFlag =
true;
5307 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5316 throw Exception(
"ConnError in LinkTrack - Final");
5320 throw Exception(
"ConnError in LinkTrack - Precheck");
5323 bool CLkErrorFlag =
false;
5325 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5329 CLkErrorFlag =
true;
5333 CLkErrorFlag =
true;
5337 CLkErrorFlag =
true;
5341 CLkErrorFlag =
true;
5349 throw Exception(
"CLkError in LinkTrack - Final");
5353 throw Exception(
"CLkError in LinkTrack - Precheck");
5357 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5386 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5402 for(
unsigned int y = 0; y < 4; y++)
5421 bool ConnectionFoundFlag =
false;
5423 if(ConnectionFoundFlag)
5427 bool LinkFoundFlag =
false;
5447 for(
unsigned int a = 0; a < 4; a++)
5456 LinkFoundFlag =
true;
5476 bool ConnErrorFlag =
false;
5478 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5482 ConnErrorFlag =
true;
5486 ConnErrorFlag =
true;
5490 ConnErrorFlag =
true;
5494 ConnErrorFlag =
true;
5502 bool CLkErrorFlag =
false;
5504 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5508 CLkErrorFlag =
true;
5512 CLkErrorFlag =
true;
5516 CLkErrorFlag =
true;
5520 CLkErrorFlag =
true;
5538 int Position1, Position2;
5544 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5546 int HLoc1 = GapMapPtr->first.first;
5547 int VLoc1 = GapMapPtr->first.second;
5548 int HLoc2 = GapMapPtr->second.first;
5549 int VLoc2 = GapMapPtr->second.second;
5552 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5556 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5560 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5564 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5582 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5583 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5593 bool FoundFlag =
false;
5605 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5606 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5607 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5636 bool FoundFlag =
false;
5649 TrackMapKeyPair.first = TrackElement.
HLoc;
5650 TrackMapKeyPair.second = TrackElement.
VLoc;
5651 TrackMapEntry.first = TrackMapKeyPair;
5656 LocationNameEntry.second = -(int)(
TrackVector.size());
5696 TrackMapKeyPair.first = HLoc;
5697 TrackMapKeyPair.second = VLoc;
5698 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5708 return(TrackMapPtr->second);
5721 TrackMapKeyPair.first = HLoc;
5722 TrackMapKeyPair.second = VLoc;
5723 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5726 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5727 throw Exception(Message);
5745 MapKeyPair.first = HLoc;
5746 MapKeyPair.second = VLoc;
5747 MapPtr = Map.find(MapKeyPair);
5748 if(MapPtr == Map.end())
5750 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5751 throw Exception(Message);
5756 return(Vector.at(MapPtr->second));
5766 THVPair InactiveTrackMapKeyPair;
5769 InactiveTrackMapKeyPair.first = HLoc;
5770 InactiveTrackMapKeyPair.second = VLoc;
5774 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5775 throw Exception(Message);
5789 bool Present =
true;
5793 TrackMapKeyPair.first = HLoc;
5794 TrackMapKeyPair.second = VLoc;
5795 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5810 bool Present =
true;
5811 THVPair InactiveTrackMapKeyPair;
5814 InactiveTrackMapKeyPair.first = HLoc;
5815 InactiveTrackMapKeyPair.second = VLoc;
5833 THVPair InactiveTrackMapKeyPair;
5838 InactiveTrackMapKeyPair.first = HLoc;
5839 InactiveTrackMapKeyPair.second = VLoc;
5848 if(InactiveTrackRange.first == InactiveTrackRange.second)
5857 RetPair.first = InactiveTrackRange.first->second;
5858 RetPair.second = (--InactiveTrackRange.second)->second;
5871 AnsiString(DivergingPosition));
5882 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5883 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5884 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5885 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5886 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5887 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5888 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5889 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5890 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5891 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5892 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5893 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5927 throw Exception(
"Error, Wrong track type in PlotGap");
5929 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5933 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5937 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5941 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5945 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5949 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5953 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5957 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5961 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5965 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5969 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5973 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5977 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5981 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5985 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5989 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6005 PosPair.first = TrackElement.
HLoc;
6006 PosPair.second = TrackElement.
VLoc;
6010 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6023 throw Exception(
"Error, Wrong track type in PlotPoints");
6034 else if(TrackElement.
SpeedTag < 132)
6052 else if(TrackElement.
SpeedTag < 132)
6085 throw Exception(
"Error, Wrong track type in PlotSignal");
6087 for(
int x = 0; x < 40; x++)
6158 for(
int x = 0; x < 40; x++)
6165 Graphics::TBitmap* SignalPlatformGraphic;
6252 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6260 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6268 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6276 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6292 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6300 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6308 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6316 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6349 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6361 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6373 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6385 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6427 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6429 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6431 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6434 if(BaseElementSpeedTag == 1)
6438 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6445 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6453 Graphics::TBitmap *RouteGraphic;
6455 if(TypeOfRoute == 1)
6459 else if(TypeOfRoute == 0)
6465 RouteGraphic = BaseGraphic;
6472 if(UpStep == DownStep)
6475 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6485 else if((DownStep - UpStep) == 1)
6490 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6500 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6513 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6523 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6539 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6549 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6559 else if(DownStep == 0)
6562 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6572 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6585 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6595 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6605 for(
int x = (UpStep + 1); x < DownStep; x++)
6610 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6614 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6635 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6642 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6648 Graphics::TBitmap *RouteGraphic;
6650 if(TypeOfRoute == 1)
6654 else if(TypeOfRoute == 0)
6660 RouteGraphic = BaseGraphic;
6669 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6679 else if((RStep - LStep) == 1)
6684 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6694 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6707 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6717 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6733 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6743 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6756 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6766 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6779 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6789 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6799 for(
int x = (LStep + 1); x < RStep; x++)
6804 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6808 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6832 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6835 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6837 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6839 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6842 if(BaseElementSpeedTag == 1)
6846 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6853 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6859 if(UpStep == DownStep)
6870 else if((DownStep - UpStep) == 1)
6889 for(
int x = (UpStep + 1); x < DownStep; x++)
6898 for(
int x = (UpStep + 1); x < DownStep; x++)
6905 for(
int x = UpStep; x <= DownStep; x++)
6918 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6925 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
6942 else if((RStep - LStep) == 1)
6961 for(
int x = (LStep + 1); x < RStep; x++)
6970 for(
int x = (LStep + 1); x < RStep; x++)
6977 for(
int x = LStep; x <= RStep; x++)
6996 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
6998 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7000 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7003 if(BaseElementSpeedTag == 1)
7007 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7014 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7020 for(
int x = UpStep; x < (DownStep + 1); x++)
7035 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7042 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7048 for(
int x = LStep; x < (RStep + 1); x++)
7067 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7070 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7072 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7074 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7079 if(BaseElementSpeedTag == 1)
7083 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7090 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7096 for(
int x = UpStep; x <= DownStep; x++)
7110 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7117 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7123 for(
int x = LStep; x <= RStep; x++)
7139 Graphics::TBitmap *RouteGraphic;
7142 if(BaseElementSpeedTag == 1)
7144 if(TypeOfRoute == 1)
7148 else if(TypeOfRoute == 0)
7154 RouteGraphic = BaseGraphic;
7158 RouteGraphic = BaseGraphic;
7164 if(TypeOfRoute == 1)
7168 else if(TypeOfRoute == 0)
7174 RouteGraphic = BaseGraphic;
7178 RouteGraphic = BaseGraphic;
7183 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7188 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7192 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7199 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7202 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7207 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7212 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7216 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7223 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7226 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7351 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7355 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7386 "," + AnsiString(VLoc));
7390 int DummyRouteNumber;
7392 TrainPresent =
false;
7396 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7398 TrackMapKeyPair.first = HLoc;
7399 TrackMapKeyPair.second = VLoc + UpStep;
7400 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7409 TrainPresent =
true;
7423 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7425 TrackMapKeyPair.first = HLoc;
7426 TrackMapKeyPair.second = VLoc + DownStep;
7427 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7436 TrainPresent =
true;
7450 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7452 TrackMapKeyPair.first = HLoc + LeftStep;
7453 TrackMapKeyPair.second = VLoc;
7454 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7463 TrainPresent =
true;
7477 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7479 TrackMapKeyPair.first = HLoc + RightStep;
7480 TrackMapKeyPair.second = VLoc;
7481 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7490 TrainPresent =
true;
7510 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7527 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7530 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7536 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7543 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7549 for(
int x = UpStep; x <= DownStep; x++)
7556 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7563 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7569 for(
int x = LStep; x <= RStep; x++)
7585 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7592 else if(TrackElement.
SpeedTag < 132)
7610 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7627 AnsiString(ScreenPosV));
7642 AnsiString(ScreenPosV));
7653 AnsiString(VPosTrue));
7667 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7679 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7680 " in TrackMap, Caller=" + (AnsiString)Caller);
7682 if(MapVecPos != (
int)a)
7684 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7685 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7686 (AnsiString)Caller);
7692 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7693 " Caller=" + (AnsiString)Caller);
7713 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7714 " in InactiveMap, Caller=" + (AnsiString)Caller);
7716 if((InactivePair.first != a) && (InactivePair.second != a))
7718 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7719 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7720 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7725 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7726 " Caller=" + (AnsiString)Caller);
7736 int Position1, Position2;
7742 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7744 int HLoc1 = GapMapPtr->first.first;
7745 int VLoc1 = GapMapPtr->first.second;
7746 int HLoc2 = GapMapPtr->second.first;
7747 int VLoc2 = GapMapPtr->second.second;
7750 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7754 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7758 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7762 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7766 unsigned int GapCount = 0;
7768 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7776 if((
GapMap.size() * 2) != GapCount)
7778 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7779 (AnsiString)Caller);
7789 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7793 throw Exception(
"Error - TrackFinished with erase element still present");
7798 AnsiString IDString;
7800 if(TrackElement.
HLoc < 0)
7802 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7806 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7808 if(TrackElement.
VLoc < 0)
7810 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7814 IDString += AnsiString(TrackElement.
VLoc);
7829 for(
int x = 1; x < String.Length() + 1; x++)
7831 if(String.IsDelimiter(
"-", x))
7836 if(x == String.Length())
7840 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7850 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7855 if(DelimPos == String.Length())
7859 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7864 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7868 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7875 if(String.SubString(1, 1) !=
"N")
7877 for(
int x = 1; x < DelimPos; x++)
7879 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7883 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7890 if(String.SubString(1, 1) ==
"N")
7892 for(
int x = 2; x < DelimPos; x++)
7894 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7898 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7905 if(String.SubString(1, 1) ==
"N")
7907 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7911 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7913 if(String.SubString(DelimPos + 1, 1) !=
"N")
7915 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7917 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7921 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7928 if(String.SubString(DelimPos + 1, 1) ==
"N")
7930 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
7932 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7936 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7943 if(String.SubString(DelimPos + 1, 1) ==
"N")
7945 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
7949 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
7954 TrackMapPtr =
TrackMap.find(HVPair);
7959 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
7965 return(TrackMapPtr->second);
7967 catch(
const Exception &e)
7970 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
7984 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
7985 int HLoc = TrackElement.
HLoc;
7986 int VLoc = TrackElement.
VLoc;
8089 AnsiString(SpeedTag));
8100 if(HVRange.first == HVRange.second)
8107 HVIt1 = HVRange.first;
8112 if(--HVRange.second != HVRange.first)
8114 HVIt2 = HVRange.second;
8118 HVIt2->second).
SpeedTag == SpeedTag)))
8138 AnsiString(SpeedTag));
8204 AnsiString TestString1, TestString2;
8209 throw Exception(
"LNPendingList size not 1 on entry");
8211 int CurrentElementNumber;
8217 int H = CurrentElement->HLoc;
8218 int V = CurrentElement->VLoc;
8219 int Tag = CurrentElement->SpeedTag;
8225 for(
int x = 0; x < 25; x++)
8235 for(
int x = 0; x < 25; x++)
8245 for(
int x = 0; x < 25; x++)
8255 for(
int x = 0; x < 25; x++)
8265 for(
int x = 0; x < 28; x++)
8275 for(
int x = 0; x < 8; x++)
8285 for(
int x = 0; x < 8; x++)
8295 for(
int x = 0; x < 4; x++)
8305 for(
int x = 0; x < 8; x++)
8315 for(
int x = 0; x < 8; x++)
8328 if(CurrentElementNumber > -1)
8333 if((ExistingName !=
"") && (ExistingName != LocationName))
8349 AddName(1, CurrentElement, LocationName);
8353 LNDone2MultiMapEntry.first = HVPair;
8364 bool FoundFlag, ErasedFlag =
false;
8366 if(SNRange.first != SNRange.second)
8370 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8377 TVIt->LocationName =
"";
8378 TVIt->ActiveTrackElementName =
"";
8411 std::pair<AnsiString, char>TempMapPair;
8419 TempMapPair.second =
'x';
8437 AnsiString(SpeedTag));
8447 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8454 int MapPos = -1 - Position;
8458 FoundElement = MapPos;
8474 FoundElement = IMPair.first;
8483 FoundElement = IMPair.second;
8504 AnsiString OldName = TrackElement->LocationName, ErrorString;
8506 TrackElement->LocationName = Name;
8507 int HLoc = TrackElement->HLoc;
8508 int VLoc = TrackElement->VLoc;
8522 if(ErrorString !=
"")
8524 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8548 if(LNDone2MultiMapIterator->second == MapPos)
8575 if(*LNPendingListIterator == MapPos)
8648 if(NameBeingChecked !=
"")
8654 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8662 NameBeingChecked = LNMMRg.second->first;
8664 if(NameBeingChecked !=
"")
8670 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8691 if(LNMMIt->second < 0)
8701 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8709 std::list<THVPair> HVLinkedList;
8712 HVPairsLinkedMap.begin()->second =
true;
8713 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8716 THVPair HVPairUnderExamination;
8717 THVPairsLinkedMap::iterator HVPLMIt;
8719 while(!HVLinkedList.empty())
8721 HVPairUnderExamination = HVLinkedList.front();
8722 HVLinkedList.pop_front();
8723 HVPairNew.first = HVPairUnderExamination.first;
8724 HVPairNew.second = HVPairUnderExamination.second - 1;
8725 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8726 if(HVPLMIt != HVPairsLinkedMap.end())
8728 if(!HVPLMIt->second)
8730 HVLinkedList.push_back(HVPLMIt->first);
8732 HVPLMIt->second =
true;
8734 HVPairNew.first = HVPairUnderExamination.first - 1;
8735 HVPairNew.second = HVPairUnderExamination.second;
8736 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8737 if(HVPLMIt != HVPairsLinkedMap.end())
8739 if(!HVPLMIt->second)
8741 HVLinkedList.push_back(HVPLMIt->first);
8743 HVPLMIt->second =
true;
8745 HVPairNew.first = HVPairUnderExamination.first;
8746 HVPairNew.second = HVPairUnderExamination.second + 1;
8747 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8748 if(HVPLMIt != HVPairsLinkedMap.end())
8750 if(!HVPLMIt->second)
8752 HVLinkedList.push_back(HVPLMIt->first);
8754 HVPLMIt->second =
true;
8756 HVPairNew.first = HVPairUnderExamination.first + 1;
8757 HVPairNew.second = HVPairUnderExamination.second;
8758 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8759 if(HVPLMIt != HVPairsLinkedMap.end())
8761 if(!HVPLMIt->second)
8763 HVLinkedList.push_back(HVPLMIt->first);
8765 HVPLMIt->second =
true;
8770 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8772 if(!HVPLMIt->second)
8791 if(LocationName ==
"")
8802 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8809 ActiveTrackElementNameMapEntry.second = 0;
8831 bool FoundFlag, ErasedFlag =
false;
8835 if(SNRange.first != SNRange.second)
8838 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8841 TVIt->LocationName =
"";
8842 TVIt->ActiveTrackElementName =
"";
8876 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8878 AnsiString LocationName;
8887 if(LocationName !=
"")
8895 if(LocationName !=
"")
8909 if(LocationName !=
"")
8911 int ModifiedPosition = -1 - Position;
8920 for(
int x = 0; x < 25; x++)
8930 else if(SpeedTag == 77)
8932 for(
int x = 0; x < 25; x++)
8942 else if(SpeedTag == 78)
8944 for(
int x = 0; x < 25; x++)
8954 else if(SpeedTag == 79)
8956 for(
int x = 0; x < 25; x++)
8966 else if(SpeedTag == 96)
8968 for(
int x = 0; x < 28; x++)
8978 else if(SpeedTag == 129)
8980 for(
int x = 0; x < 8; x++)
8990 else if(SpeedTag == 130)
8992 for(
int x = 0; x < 8; x++)
9002 else if(SpeedTag == 145)
9004 for(
int x = 0; x < 8; x++)
9014 else if(SpeedTag == 146)
9016 for(
int x = 0; x < 8; x++)
9026 else if(SpeedTag == 131)
9028 for(
int x = 0; x < 4; x++)
9051 AnsiString(SpeedTag));
9063 if(TempElement->LocationName !=
"")
9065 LocationName = TempElement->LocationName;
9066 FoundElement = IMPair.first;
9074 if(TempElement->LocationName !=
"")
9076 LocationName = TempElement->LocationName;
9077 FoundElement = IMPair.second;
9089 if(TempElement->LocationName !=
"")
9091 LocationName = TempElement->LocationName;
9092 FoundElement = -1 - Position;
9108 unsigned int Count = 0;
9115 AnsiString SName, TName, ErrorString;
9117 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9123 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9124 AnsiString(Caller));
9137 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9138 AnsiString(Caller));
9145 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9146 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9151 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9157 if(ErrorString !=
"")
9159 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9161 if(SNIt->second != -1 - (
int)x)
9163 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9164 AnsiString(Caller));
9170 bool FoundFlag =
false;
9179 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9180 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9184 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9185 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9186 AnsiString(Caller));
9191 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9192 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9202 if(ErrorString !=
"")
9204 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9206 if(SNIt->second != (
int)x)
9208 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9209 AnsiString(Caller));
9219 AnsiString &ErrorString)
9227 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9229 bool FoundFlag =
false;
9233 if(SNRange.first == SNRange.second)
9235 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9237 return(SNRange.first);
9241 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9243 if(SNIterator->second < 0)
9245 int TVPos = -1 - SNIterator->second;
9247 if(TVIt == TrackElement)
9256 int ITVPos = SNIterator->second;
9258 if(ITVIt == TrackElement)
9269 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9286 LocationNameEntry.first = NewName;
9287 LocationNameEntry.second = SNIterator->second;
9301 int TruePos = -1 - Position;
9305 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9315 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9338 InactiveTrack2MultiMapIterator++)
9340 if(InactiveTrack2MultiMapIterator->second > VecPos)
9342 InactiveTrack2MultiMapIterator->second--;
9350 LocationNameMultiMapIterator++)
9352 if(LocationNameMultiMapIterator->second < 0)
9356 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9358 LocationNameMultiMapIterator->second--;
9380 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9382 if(TrackMapIterator->second > VecPos)
9384 TrackMapIterator->second--;
9392 LocationNameMultiMapIterator++)
9394 if(LocationNameMultiMapIterator->second >= 0)
9400 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9402 LocationNameMultiMapIterator->second++;
9406 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9412 if(TkEl.
Conn[0] ==
int(VecPos))
9417 if(TkEl.
Conn[0] >
int(VecPos))
9421 if(TkEl.
Conn[0] > -1)
9447 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9453 LocationNameEntry.second = -1 - TVPos;
9464 LocationNameEntry.second = ITVPos;
9506 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9538 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9566 AnsiString((
short)FirstTrack));
9567 bool LengthDifferent =
false, SpeedDifferent =
false;
9574 int EXArray[16][2] =
9576 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9577 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9580 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9581 Graphics::TBitmap *Bitmap;
9585 InLink = TrackElement.
Link[0];
9586 OutLink = TrackElement.
Link[1];
9590 InLink = TrackElement.
Link[2];
9591 OutLink = TrackElement.
Link[3];
9593 for(
int x = 0; x < 16; x++)
9595 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9602 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9621 else if(TrackElement.
SpeedTag == 54)
9625 else if(TrackElement.
SpeedTag == 55)
9636 else if(TrackElement.
SpeedTag == 58)
9640 else if(TrackElement.
SpeedTag == 59)
9645 else if(Index == 14)
9651 else if(TrackElement.
SpeedTag == 52)
9655 else if(TrackElement.
SpeedTag == 57)
9660 else if(Index == 15)
9666 else if(TrackElement.
SpeedTag == 53)
9670 else if(TrackElement.
SpeedTag == 56)
9684 if(LengthDifferent && SpeedDifferent)
9752 else if(LengthDifferent && !SpeedDifferent)
9899 AnsiString((
short)FirstTrack));
9900 LengthDifferent =
false;
9901 SpeedDifferent =
false;
9906 LengthDifferent =
true;
9910 SpeedDifferent =
true;
9912 if(LengthDifferent || SpeedDifferent)
9925 LengthDifferent =
true;
9929 SpeedDifferent =
true;
9931 if(LengthDifferent || SpeedDifferent)
9944 LengthDifferent =
true;
9948 SpeedDifferent =
true;
9950 if(LengthDifferent || SpeedDifferent)
10030 AnsiString TempName;
10031 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10032 bool ForwardSet, ReverseSet;
10034 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10039 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10041 ForwardSet =
false;
10042 ReverseSet =
false;
10077 for(
int y = 0; y < 2; y++)
10108 StartElement = TempElement;
10109 StartVecPos = VecPos;
10112 EntryPos = 1 - Dir;
10113 StartEntryPos = 1 - Dir;
10122 VecPos = TempElement.
Conn[1 - EntryPos];
10123 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10125 EntryPos = TempEntryPos;
10153 ForwardNumber = ((Count + 1) / 2) + 1;
10154 ReverseNumber = (Count - ForwardNumber) + 1;
10156 EntryPos = 1 - Dir;
10157 TempElement = StartElement;
10158 VecPos = StartVecPos;
10159 if(Count == ForwardNumber)
10164 if(Count == ReverseNumber)
10172 VecPos = TempElement.
Conn[1 - EntryPos];
10173 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10175 EntryPos = TempEntryPos;
10177 if(Count == ForwardNumber)
10182 if(Count == ReverseNumber)
10194 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10330 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10386 if((TextH / 16) - 1 <
HLocMin)
10390 if((TextH / 16) + 1 >
HLocMax)
10394 if((TextV / 16) - 1 <
VLocMin)
10398 if((TextV / 16) + 1 >
VLocMax)
10428 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10429 bool &UserGraphicFoundFlag)
10432 TUserGraphicVector::iterator UserGraphicPtr;
10434 UserGraphicFoundFlag =
false;
10441 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10442 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10444 UserGraphicItem = x;
10445 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10446 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10447 UserGraphicFoundFlag =
true;
10465 int SpeedTag = TrackElement.
SpeedTag;
10469 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10518 return(GraphicOutput);
10526 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10529 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10542 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10543 " in InactiveTrackElementAt");
10554 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10556 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10581 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10582 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10586 if(SNRange.first == SNRange.second)
10591 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10593 if(SNIterator->second < 0)
10607 HVPair.first = InactiveElement.
HLoc;
10608 HVPair.second = InactiveElement.
VLoc;
10612 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10614 int TVPos =
TrackMap.find(HVPair)->second;
10617 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10623 FirstNamedExitPos = 0;
10625 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10627 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10628 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10631 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10633 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10634 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10635 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10638 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10648 FirstNamedExitPos = 1;
10650 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10652 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10653 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10656 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10658 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10659 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10660 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10663 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10679 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10693 AnsiString(FirstNamedElementPos));
10694 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10695 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10697 SecondNamedElementPos = -1;
10698 FirstNamedLinkedElementPos = -1;
10699 SecondNamedLinkedElementPos = -1;
10703 if(SNRange.first == SNRange.second)
10708 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10710 if(SNIterator->second < 0)
10720 HVPair.first = InactiveElement.
HLoc;
10721 HVPair.second = InactiveElement.
VLoc;
10733 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10737 int TVPos =
TrackMap.find(HVPair)->second;
10738 if(TVPos != FirstNamedElementPos)
10744 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10750 FirstNamedExitPos = 0;
10752 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10754 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10755 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10758 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10760 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10761 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10762 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10765 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10767 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10768 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10769 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10778 FirstNamedExitPos = 1;
10780 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10782 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10783 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10786 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10788 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10789 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10790 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10793 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10795 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10796 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10797 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10818 if(SNRange.first != SNRange.second)
10820 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10822 if(SNIterator->second < 0)
10844 "," + AnsiString(SpeedTag));
10855 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10885 else if(SpeedTag == 69)
10911 else if(SpeedTag == 70)
10937 else if(SpeedTag == 71)
10974 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
10975 if(NextEntryPos < 0)
10988 if(NextEntryPos > 1)
11007 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
11019 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
11020 bool FoundFlag =
false;
11035 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
11036 bool FoundFlag =
false;
11061 VPosHi = 16 * VLocHi;
11062 VPosLo = 16 * VLocLo;
11081 AnsiString(EndTVPosition));
11092 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11093 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11094 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11095 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11097 if(Link0Squares <= Link1Squares)
11115 AnsiString(LinkPos));
11134 if((LinkPos == 1) && (TE.
Attribute == 0))
11139 else if(LinkPos == 1)
11145 else if((LinkPos == 3) && (TE.
Attribute == 1))
11150 else if(LinkPos == 3)
11157 else if(LinkPos == 0)
11162 else if(LinkPos == 1)
11167 else if(LinkPos == 2)
11172 else if(LinkPos == 3)
11177 throw Exception(
"Error, failure in GetExitPos");
11226 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11230 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11272 "," + AnsiString(DiagonalLinkNumber));
11277 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11282 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11287 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11292 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11308 AnsiString JustFileName =
"";
11313 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11320 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11339 typedef std::list<int> TNamePosList;
11340 TNamePosList NamePosList;
11341 typedef TNamePosList::iterator TNPLIt;
11343 typedef std::list<int> TOnePlatList;
11344 TOnePlatList OnePlatList;
11345 typedef TOnePlatList::iterator TOPLIt;
11348 NamePosList.clear();
11349 OnePlatList.clear();
11350 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11352 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11354 NamePosList.push_back(x);
11359 if(!NamePosList.empty())
11361 OnePlatList.push_back(NamePosList.back());
11362 NamePosList.pop_back();
11364 while(!OnePlatList.empty())
11366 TempInt = OnePlatList.front();
11369 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11370 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11372 OnePlatList.push_back(TempElement.
Conn[0]);
11373 NamePosList.erase(NPLIt);
11375 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11376 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11378 OnePlatList.push_back(TempElement.
Conn[1]);
11379 NamePosList.erase(NPLIt);
11382 OnePlatList.erase(OnePlatList.begin());
11383 if(OnePlatList.empty())
11386 if(!NamePosList.empty())
11388 OnePlatList.push_back(NamePosList.back());
11389 NamePosList.pop_back();
11406 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11421 throw Exception(
"Return value negative in call to LastElementNumber");
11433 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11447 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11459 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11460 " in GetModifiablePrefDirElementAt");
11470 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11472 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11482 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11484 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11501 int TrackVectorPosition;
11553 FinishElement =
false;
11554 int TrackVectorPosition;
11576 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11586 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11609 for(
int x = 0; x < 4; x++)
11632 FinishElement =
true;
11640 for(
int x = 0; x < 4; x++)
11652 FinishElement =
true;
11660 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11667 .ELinkPos] ==
Lead))
11683 FinishElement =
true;
11702 FinishElement =
true;
11721 FinishElement =
true;
11736 FinishElement =
true;
11745 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11761 FinishElement =
true;
11767 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11790 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11791 int VectorCount = 0;
11795 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11797 for(
int x = 0; x < VectorCount; x++)
11804 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11808 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11809 SearchElement.
ELinkPos = NextELinkPos;
11830 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
11832 SearchElement.
XLinkPos = NextXLinkPos;
11858 for(
int x = 0; x < VectorCount; x++)
11870 for(
int x = 0; x < VectorCount; x++)
11884 for(
int x = 0; x < VectorCount; x++)
11898 for(
int x = 0; x < VectorCount; x++)
11908 for(
int x = 0; x < VectorCount; x++)
11919 SearchElement.
XLink = SearchElement.
Link[1];
11938 SearchElement.
XLink = SearchElement.
Link[3];
11951 for(
int x = 0; x < VectorCount; x++)
11966 XLinkPos = NextXLinkPos;
11967 CurrentTrackElement = SearchElement;
11986 throw Exception(
"Error, SearchVector empty");
11993 for(
int x = 0; x < 4; x++)
12046 throw Exception(
"Error in EntryExitNumber 1");
12065 if(PrefDirElement.
XLink == -1)
12077 if(PrefDirElement.
XLink != -1)
12081 throw Exception(
"Error in EntryExitNumber 2");
12119 LeadingPoints =
false;
12147 LeadingPoints =
true;
12163 AnsiString ErrorString;
12164 bool Error =
false;
12171 ErrorString =
"HLoc";
12177 ErrorString =
"VLoc";
12183 ErrorString =
"ELink";
12189 ErrorString =
"ELinkPos";
12195 ErrorString =
"XLink";
12201 ErrorString =
"XLinkPos";
12207 ErrorString =
"Tag";
12213 ErrorString =
"TrackVectorPosition";
12219 ErrorString =
"EXNumber";
12226 ErrorString =
"CheckCount";
12233 ErrorString =
"EntryGraphicPtr";
12239 ErrorString =
"EntryDirectionGraphicPtr";
12248 ErrorString =
"Last XLink not connected to this element";
12255 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12279 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12336 AnsiString((
short)BuildingPrefDir));
12339 if(PrefDirSize() == 0)
12344 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12356 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12368 if(x == (PrefDirSize() - 1))
12377 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12379 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12380 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12381 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12383 if(PrefDirSize() > 1)
12385 unsigned int LatestPos = PrefDirSize() - 1;
12386 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12387 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12388 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12409 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12412 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12416 H = MMIT->first.first;
12417 V = MMIT->first.second;
12420 if(PrefDirPos0 > -1)
12424 if(PrefDirPos1 > -1)
12428 if(PrefDirPos2 > -1)
12432 if(PrefDirPos3 > -1)
12436 if(PrefDirPos3 > -1)
12452 else if(PrefDirPos2 > -1)
12494 else if(PrefDirPos1 > -1)
12517 else if(PrefDirPos0 > -1)
12536 int NumberOfPrefDirElements = 0;
12539 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12541 VecFile >> TempInt;
12544 VecFile >> TempInt;
12545 LoadPrefDirElement.
ELink = TempInt;
12546 VecFile >> TempInt;
12547 LoadPrefDirElement.
ELinkPos = TempInt;
12548 VecFile >> TempInt;
12549 LoadPrefDirElement.
XLink = TempInt;
12550 VecFile >> TempInt;
12551 LoadPrefDirElement.
XLinkPos = TempInt;
12552 VecFile >> TempInt;
12553 LoadPrefDirElement.
EXNumber = TempInt;
12554 VecFile >> TempInt;
12559 if(!(LoadPrefDirElement.
IsARoute))
12585 int NumberOfPrefDirElements = 0;
12588 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12590 VecFile >> TempInt;
12591 VecFile >> TempInt;
12594 VecFile >> TempInt;
12595 LoadPrefDirElement.
ELink = TempInt;
12596 VecFile >> TempInt;
12597 LoadPrefDirElement.
ELinkPos = TempInt;
12598 VecFile >> TempInt;
12599 LoadPrefDirElement.
XLink = TempInt;
12600 VecFile >> TempInt;
12601 LoadPrefDirElement.
XLinkPos = TempInt;
12602 VecFile >> TempInt;
12603 LoadPrefDirElement.
EXNumber = TempInt;
12604 VecFile >> TempInt;
12609 if(!(LoadPrefDirElement.
IsARoute))
12637 int NumberOfPrefDirElements = 0;
12640 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12645 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12652 VecFile >> TempInt;
12653 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12658 VecFile >> TempInt;
12659 if((TempInt < -1) || (TempInt > 9))
12664 VecFile >> TempInt;
12665 if((TempInt < -1) || (TempInt > 3))
12670 VecFile >> TempInt;
12671 if((TempInt < -1) || (TempInt > 9))
12676 VecFile >> TempInt;
12677 if((TempInt < -1) || (TempInt > 3))
12682 VecFile >> TempInt;
12683 if((TempInt < -1) || (TempInt > 27))
12688 VecFile >> TempInt;
12696 VecFile >> TempInt;
12697 if((TempInt != 0) && (TempInt != 1))
12702 VecFile >> TempInt;
12703 if((TempInt != 0) && (TempInt != 1))
12708 VecFile >> TempInt;
12709 if((TempInt != 0) && (TempInt != 1))
12732 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12734 VecFile << y <<
'\n';
12735 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12745 if(y == (NumberOfPrefDirElements - 1))
12747 VecFile <<
"************" <<
'\0' <<
'\n';
12751 VecFile <<
"******" <<
'\0' <<
'\n';
12765 for(
int y = 0; y < NumberOfSearchElements; y++)
12767 VecFile << y <<
'\n';
12768 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12778 if(y == (NumberOfSearchElements - 1))
12780 VecFile <<
"************" <<
'\0' <<
'\n';
12784 VecFile <<
"******" <<
'\0' <<
'\n';
12897 bool AlreadyPresent, FoundFlag;
12898 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12900 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
12904 AlreadyPresent =
false;
12909 AlreadyPresent =
true;
12913 AlreadyPresent =
true;
12917 AlreadyPresent =
true;
12921 AlreadyPresent =
true;
12924 if(!AlreadyPresent)
12971 for(
unsigned int z = 0; z < 4; z++)
12979 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
12993 bool DiscrepancyFound =
false;
13004 DiscrepancyFound =
true;
13009 DiscrepancyFound =
true;
13014 DiscrepancyFound =
true;
13019 DiscrepancyFound =
true;
13024 DiscrepancyFound =
true;
13030 DiscrepancyFound =
true;
13033 if(DiscrepancyFound)
13035 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
13050 bool DiscrepancyFound =
false;
13061 DiscrepancyFound =
true;
13065 DiscrepancyFound =
true;
13070 DiscrepancyFound =
true;
13075 DiscrepancyFound =
true;
13080 DiscrepancyFound =
true;
13086 DiscrepancyFound =
true;
13090 return(!DiscrepancyFound);
13102 bool FoundFlag =
false;
13103 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13111 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13112 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13114 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13116 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13117 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13118 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13123 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13124 +
" Caller=" + (AnsiString)Caller);
13150 PrefDirMapKeyPair.first = HLoc;
13151 PrefDirMapKeyPair.second = VLoc;
13152 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13155 if(ItPair.first == ItPair.second)
13163 PrefDirPos0 = ItPair.first->second;
13165 if(ItPair.first == ItPair.second)
13170 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13172 PrefDirPos1 = ItPair.first->second;
13175 if(ItPair.first == ItPair.second)
13180 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13182 PrefDirPos2 = ItPair.first->second;
13185 if(ItPair.first == ItPair.second)
13190 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13192 PrefDirPos3 = ItPair.first->second;
13207 +
"," + AnsiString(LinkNumberPos));
13209 int PD0, PD1, PD2, PD3;
13210 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13214 PD0, PD1, PD2, PD3);
13226 LinkedPrefDirVectorNumber = PD0;
13235 LinkedPrefDirVectorNumber = PD1;
13245 LinkedPrefDirVectorNumber = PD0;
13254 LinkedPrefDirVectorNumber = PD1;
13263 LinkedPrefDirVectorNumber = PD2;
13272 LinkedPrefDirVectorNumber = PD3;
13277 LinkedPrefDirVectorNumber = -1;
13283 LinkedPrefDirVectorNumber = -1;
13288 catch(
const Exception &e)
13290 LinkedPrefDirVectorNumber = -1;
13305 +
"," + AnsiString(LinkNumberPos));
13307 int PD0, PD1, PD2, PD3;
13308 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13312 PD0, PD1, PD2, PD3);
13325 LinkedPrefDirVectorNumber = PD0;
13335 LinkedPrefDirVectorNumber = PD1;
13340 LinkedPrefDirVectorNumber = -1;
13348 LinkedPrefDirVectorNumber = PD0;
13357 LinkedPrefDirVectorNumber = PD1;
13366 LinkedPrefDirVectorNumber = PD2;
13375 LinkedPrefDirVectorNumber = PD3;
13380 LinkedPrefDirVectorNumber = -1;
13386 LinkedPrefDirVectorNumber = -1;
13391 catch(
const Exception &e)
13393 LinkedPrefDirVectorNumber = -1;
13405 int PD0, PD1, PD2, PD3;
13457 THVPair PrefDir4MultiMapKeyPair;
13460 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13461 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13462 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13485 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13504 AnsiString(ErasedElementNumber));
13509 if(MapPtr->second > ErasedElementNumber)
13531 throw Exception(
"PrefDirVectorPosition out of range");
13534 THVPair PrefDir4MultiMapKeyPair;
13536 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13537 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13538 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13541 if(ItPair.first == ItPair.second)
13544 return(ItPair.first);
13548 if(ItPair.first->second == PrefDirVectorPosition)
13552 return(ItPair.first);
13555 if(ItPair.first == ItPair.second)
13558 return(ItPair.first);
13560 if(ItPair.first->second == PrefDirVectorPosition)
13564 return(ItPair.first);
13567 if(ItPair.first == ItPair.second)
13570 return(ItPair.first);
13572 if(ItPair.first->second == PrefDirVectorPosition)
13576 return(ItPair.first);
13579 if(ItPair.first == ItPair.second)
13582 return(ItPair.first);
13584 if(ItPair.first->second == PrefDirVectorPosition)
13588 return(ItPair.first);
13592 return(ItPair.first);
13605 THVPair PrefDir4MultiMapKeyPair;
13607 PrefDir4MultiMapKeyPair.first = HLoc;
13608 PrefDir4MultiMapKeyPair.second = VLoc;
13609 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13612 if(ItPair.first == ItPair.second)
13620 return(ItPair.first->second);
13629 bool ErasedFlag =
false;
13631 if(ErasedTrackVectorPosition > -1)
13640 ErasedFlag =
false;
13642 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13647 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13652 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13657 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13662 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13670 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13674 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13678 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13682 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13686 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13701 OverallDistance = 0;
13702 OverallSpeedLimit = 0;
13703 LeadingPointsAtLastElement =
false;
13711 LeadingPointsAtLastElement =
true;
13720 OverallDistance += PrefDirElement.
Length23;
13721 if(OverallSpeedLimit != -1)
13731 OverallSpeedLimit = -1;
13738 OverallDistance += PrefDirElement.
Length01;
13739 if(OverallSpeedLimit != -1)
13749 OverallSpeedLimit = -1;
13768 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13771 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13775 HLoc = MMIT->first.first;
13776 VLoc = MMIT->first.second;
13781 if(PrefDirPos0 > -1)
13785 if(PrefDirPos1 > -1)
13789 if(PrefDirPos2 > -1)
13793 if(PrefDirPos3 > -1)
13797 if(PrefDirPos3 > -1)
13800 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13802 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13804 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13806 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13813 else if(PrefDirPos2 > -1)
13818 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13820 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13822 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
13831 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13833 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13835 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13844 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13846 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13848 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13855 else if(PrefDirPos1 > -1)
13860 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13862 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13870 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13872 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13878 else if(PrefDirPos0 > -1)
13880 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13897 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13900 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13921 if(PrefDirPos0 > -1)
13925 if(PrefDirPos1 > -1)
13929 if(PrefDirPos2 > -1)
13933 if(PrefDirPos3 > -1)
13937 if(PrefDirPos3 > -1)
13942 else if(PrefDirPos2 > -1)
13944 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
13955 else if(PrefDirPos1 > -1)
13957 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
13968 else if(PrefDirPos0 > -1)
13970 if(PrefDirElement0.
XLinkPos == EntryPos)
14007 ElementIn.
VLoc +
"," + XLink);
14009 bool TrackFoundFlag;
14012 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
14024 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14034 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14048 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14058 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14072 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14082 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14096 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14106 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14129 bool FoundFlag, ContFlag, FoundElements =
false;
14130 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14135 LastIteratorValue++;
14160 if(PDVIt->XLinkPos == 0)
14165 StartElement = *PDVIt;
14174 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
14176 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14177 if(PrefDirPos0 == -1)
14181 bool NextElementFoundFlag =
false;
14185 NextElementFoundFlag =
true;
14187 if(PrefDirPos1 > -1)
14192 NextElementFoundFlag =
true;
14195 if(PrefDirPos2 > -1)
14200 NextElementFoundFlag =
true;
14203 if(PrefDirPos3 > -1)
14208 NextElementFoundFlag =
true;
14211 if(!NextElementFoundFlag)
14241 EndElement = NextElement;
14245 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
14247 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14248 if(PrefDirPos0 == -1)
14258 if(PrefDirPos1 > -1)
14266 if(PrefDirPos2 > -1)
14274 if(PrefDirPos3 > -1)
14305 FoundElements =
true;
14339 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14341 int TrackVectorPosition;
14377 int LockedVectorNumber;
14400 bool InPrefDirFlag =
false;
14403 int PrefDirPos0 = -1;
14404 int PrefDirPos1 = -1;
14405 int PrefDirPos2 = -1;
14406 int PrefDirPos3 = -1;
14410 int PrefDirVecPos[4] =
14412 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14415 for(
int x = 0; x < 4; x++)
14417 int b = PrefDirVecPos[x];
14427 InPrefDirFlag =
true;
14441 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14449 if(DummyPair.first > -1)
14451 throw Exception(
"Selection in two routes - should never happen!");
14453 if(RoutePair.first > -1)
14529 IDInt &ReqPosRouteID,
bool &PointsChanged)
14563 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14613 bool InPrefDirFlag =
false;
14616 int PrefDirPos0 = -1;
14617 int PrefDirPos1 = -1;
14618 int PrefDirPos2 = -1;
14619 int PrefDirPos3 = -1;
14622 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14623 int PrefDirVecPos[4] =
14625 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14628 for(
int x = 0; x < 4; x++)
14630 int b = PrefDirVecPos[x];
14633 InPrefDirFlag =
true;
14647 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14656 if(RoutePair.first > -1)
14658 if(RoutePair.second != 0)
14675 EndElement1 = RouteElement;
14676 EndElement2 = BlankElement;
14776 PointsChanged =
true;
14804 PointsChanged =
true;
14827 PointsChanged =
true;
14856 PointsChanged =
true;
14870 PointsChanged =
true;
14889 PointsChanged =
true;
14903 PointsChanged =
true;
14919 PointsChanged =
true;
14973 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag)
15026 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
15027 AnsiString((
short)AutoSigsFlag));
15028 int VectorCount = 0;
15032 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
15036 for(
int x = 0; x < VectorCount; x++)
15044 bool FirstPass =
true;
15054 for(
int x = 0; x < VectorCount; x++)
15063 for(
int x = 0; x < VectorCount; x++)
15075 for(
int x = 0; x < VectorCount; x++)
15083 int NextPosition = PrefDirElement.
Conn[XLinkPos];
15087 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
15088 SearchElement.
ELinkPos = NextELinkPos;
15089 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
15110 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
15112 SearchElement.
XLinkPos = NextXLinkPos;
15124 for(
int x = 0; x < VectorCount; x++)
15138 if(RoutePair.first > -1)
15147 for(
int x = 0; x < VectorCount; x++)
15156 if(SecondPair.first > -1)
15165 for(
int x = 0; x < VectorCount; x++)
15179 for(
int x = 0; x < VectorCount; x++)
15190 for(
int x = 0; x < VectorCount; x++)
15199 for(
int x = 0; x < VectorCount; x++)
15208 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15212 for(
int x = 0; x < VectorCount; x++)
15222 bool InPrefDirFlag =
false;
15223 PrefDirElement1 = BlankElement;
15224 PrefDirElement2 = BlankElement;
15227 int PrefDirPos0 = -1;
15228 int PrefDirPos1 = -1;
15229 int PrefDirPos2 = -1;
15230 int PrefDirPos3 = -1;
15233 int PrefDirVecPos[4] =
15235 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15237 for(
int x = 0; x < 4; x++)
15239 int b = PrefDirVecPos[x];
15242 InPrefDirFlag =
true;
15255 for(
int x = 0; x < VectorCount; x++)
15267 for(
int x = 0; x < VectorCount; x++)
15283 for(
int x = 0; x < VectorCount; x++)
15303 for(
int x = 0; x < VectorCount; x++)
15320 for(
int x = 0; x < VectorCount; x++)
15330 for(
int x = 0; x < VectorCount; x++)
15341 int SearchPos1 = SearchElement.
Attribute + 1;
15343 if(SearchPos1 == 2)
15347 if(SearchPos1 == 1)
15355 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15356 SearchElement.
XLinkPos = SearchPos1;
15357 InPrefDirFlag =
false;
15358 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15360 SearchElement = PrefDirElement1;
15361 InPrefDirFlag =
true;
15363 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15365 SearchElement = PrefDirElement2;
15366 InPrefDirFlag =
true;
15372 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15376 for(
int x = 0; x < VectorCount; x++)
15403 for(
int x = 0; x < VectorCount; x++)
15421 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15422 SearchElement.
XLinkPos = SearchPos2;
15423 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15425 SearchElement = PrefDirElement1;
15427 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15429 SearchElement = PrefDirElement2;
15433 for(
int x = 0; x < VectorCount; x++)
15441 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15445 for(
int x = 0; x < VectorCount; x++)
15473 for(
int x = 0; x < VectorCount; x++)
15485 for(
int x = 0; x < VectorCount; x++)
15495 SearchElement = PrefDirElement1;
15504 XLinkPos = SearchElement.
XLinkPos;
15505 PrefDirElement = SearchElement;
15562 unsigned int TruncatePrefDirPosition = 0;
15635 throw Exception(
"Error - failed to validate extended route for preferred route");
15690 throw Exception(
"Error - failed to validate single route for preferred route");
15735 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
15737 int TrackVectorPosition;
15774 int LockedVectorNumber;
15808 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
15809 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
15812 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
15818 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
15819 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
15822 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
15836 if(RoutePair.first > -1)
16034 EndElement1.
ELink = EndElement1.
Link[0];
16035 EndElement1.
XLink = EndElement1.
Link[1];
16038 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
16043 EndElement2.
ELink = EndElement2.
Link[1];
16044 EndElement2.
XLink = EndElement2.
Link[0];
16047 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
16091 if(RoutePair.first > -1)
16093 if(RoutePair.second != 0)
16116 EndElement2 = BlankElement;
16201 PointsChanged =
true;
16227 PointsChanged =
true;
16249 PointsChanged =
true;
16275 PointsChanged =
true;
16289 PointsChanged =
true;
16329 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16330 int VectorCount = 0;
16333 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16334 (CurrentTrackElement.
Link[XLinkPos] == 9))
16338 for(
int x = 0; x < VectorCount; x++)
16350 for(
int x = 0; x < VectorCount; x++)
16357 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16359 for(
int x = 0; x < VectorCount; x++)
16366 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16370 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16371 SearchElement.
ELinkPos = NextELinkPos;
16392 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16394 SearchElement.
XLinkPos = NextXLinkPos;
16407 for(
int x = 0; x < VectorCount; x++)
16421 if(RoutePair.first > -1)
16430 for(
int x = 0; x < VectorCount; x++)
16439 if(SecondPair.first > -1)
16448 for(
int x = 0; x < VectorCount; x++)
16462 for(
int x = 0; x < VectorCount; x++)
16473 for(
int x = 0; x < VectorCount; x++)
16482 for(
int x = 0; x < VectorCount; x++)
16491 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16495 for(
int x = 0; x < VectorCount; x++)
16508 for(
int x = 0; x < VectorCount; x++)
16540 for(
int x = 0; x < VectorCount; x++)
16550 for(
int x = 0; x < VectorCount; x++)
16561 int SearchPos1 = SearchElement.
Attribute + 1;
16563 if(SearchPos1 == 2)
16567 if(SearchPos1 == 1)
16576 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16577 SearchElement.
XLinkPos = SearchPos1;
16579 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16583 for(
int x = 0; x < VectorCount; x++)
16608 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16609 SearchElement.
XLinkPos = SearchPos2;
16611 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16615 for(
int x = 0; x < VectorCount; x++)
16634 for(
int x = 0; x < VectorCount; x++)
16649 CurrentTrackElement = SearchElement;
16650 XLinkPos = SearchElement.
XLinkPos;
16672 throw Exception(
"Error, SearchVector empty");
16684 for(
int x = 0; x < 4; x++)
16726 throw Exception(
"Error in EntryExitNumber 3");
16781 unsigned int TruncatePrefDirPosition = 0;
16841 throw Exception(
"Failed to validate extended route for nonpreferred route");
16886 throw Exception(
"Failed to validate single route for nonpreferred route");
16906 if(!PrefDirVector.empty())
16910 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
16915 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
16950 if(!PrefDirVector.empty())
16953 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
16955 int ForwardLinkedRouteNumber, Attribute = 0;
16962 if(ForwardLinkedRouteNumber > -1)
16964 int NextForwardLinkedRouteNumber = -1;
16968 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
16978 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
16998 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
17006 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
17037 NextForwardLinkedRouteNumber = -1;
17038 for(
unsigned int x = 0; x < PrefDirSize(); x++)
17040 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
17041 if(PrefDirVector.at(x).TrackType ==
Bridge)
17043 if(PrefDirVector.at(x).XLinkPos < 2)
17045 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
17049 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
17057 if(PrefDirVector.at(x).TrackType ==
Buffers)
17069 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
17078 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
17080 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
17088 if(x == PrefDirSize() - 1)
17132 AnsiString(PrefDirVectorStartPosition));
17137 bool SkipContinuationAndBufferAttributeChange =
false;
17139 if(!PrefDirVector.empty())
17141 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
17144 if(PrefDirPtr->TrackType ==
Bridge)
17146 if(PrefDirPtr->XLinkPos < 2)
17157 SkipContinuationAndBufferAttributeChange =
true;
17172 SkipContinuationAndBufferAttributeChange =
true;
17180 SkipContinuationAndBufferAttributeChange =
true;
17182 if(!SkipContinuationAndBufferAttributeChange)
17184 if(PrefDirVector.back().TrackType ==
Buffers)
17193 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
17196 if(PrefDirPtr->TrackType ==
Bridge)
17198 if(PrefDirPtr->XLinkPos < 2)
17214 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
17223 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
17225 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
17226 PrefDirPtr->PrefDirRoute)
17230 int LockedVecNum = 0;
17232 bool KeepAttributeAt0ForLockedRoute =
false;
17237 KeepAttributeAt0ForLockedRoute =
true;
17257 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute)
17285 "," + AnsiString((
short)PrefDirRoute));
17286 bool ElementInRoute =
false;
17287 bool TrainOccupyingRoute =
false;
17293 ElementInRoute =
true;
17297 if(!ElementInRoute)
17325 TrainOccupyingRoute =
true;
17392 if(LRVIT->RouteNumber == RouteNumber)
17406 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17407 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17419 bool ExistingLockedRouteModified =
false;
17432 if(LRVIT->RouteNumber == RouteNumber)
17436 ExistingLockedRouteModified =
true;
17440 if(!ExistingLockedRouteModified)
17530 AnsiString((
short)PrefDirRoute));
17555 AnsiString((
short)PrefDirRoute));
17565 RouteFlashElement.
HLoc = H;
17566 RouteFlashElement.
VLoc = V;
17582 int H = PrefDirPtr->HLoc;
17583 int V = PrefDirPtr->VLoc;
17650 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
17656 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
17659 OverlayPlotted =
false;
17669 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17671 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
17674 return(AllRoutesVector.at(At));
17683 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17685 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
17688 return(AllRoutesVector.at(At));
17699 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17701 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
17711 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17713 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
17731 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
17732 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17735 RouteTruncateFlag =
true;
17737 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
17738 RouteTruncateFlag =
false;
17767 AnsiString(LinkPos));
17768 if(TrackVectorPosition == -1)
17773 THVPair Route2MultiMapKeyPair;
17777 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17780 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17790 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17792 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17795 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
17796 Route2MultiMapIterator->second.second);
17797 EntryLinkPos = PrefDirElement1.
ELinkPos;
17798 ExitLinkPos = PrefDirElement1.
XLinkPos;
17799 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17800 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17812 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17824 Graphics::TBitmap* &EntryDirectionGraphicPtr)
17834 AnsiString(LinkPos));
17837 if(TrackVectorPosition == -1)
17842 THVPair Route2MultiMapKeyPair;
17846 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17849 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17854 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17856 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17858 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
17859 Route2MultiMapIterator->second.second);
17860 EntryLinkPos = PrefDirElement1.
ELinkPos;
17861 ExitLinkPos = PrefDirElement1.
XLinkPos;
17862 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17863 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17867 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
17868 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17875 return(AutoSigsRoute);
17880 return(NotAutoSigsRoute);
17886 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
17887 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17894 return(AutoSigsRoute);
17899 return(NotAutoSigsRoute);
17903 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17905 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17906 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17908 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
17909 EntryLinkPos = PrefDirElement2.
ELinkPos;
17910 ExitLinkPos = PrefDirElement2.
XLinkPos;
17911 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17912 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17916 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
17923 return(AutoSigsRoute);
17928 return(NotAutoSigsRoute);
17934 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
17941 return(AutoSigsRoute);
17946 return(NotAutoSigsRoute);
17950 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
17951 EntryLinkPos = PrefDirElement3.
ELinkPos;
17952 ExitLinkPos = PrefDirElement3.
XLinkPos;
17953 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17954 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17958 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
17965 return(AutoSigsRoute);
17970 return(NotAutoSigsRoute);
17976 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
17983 return(AutoSigsRoute);
17988 return(NotAutoSigsRoute);
18004 AnsiString(LinkPos));
18005 if(TrackVectorPosition == -1)
18011 THVPair Route2MultiMapKeyPair;
18015 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
18018 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18024 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18026 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18028 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
18029 Route2MultiMapIterator->second.second);
18030 EntryLinkPos = PrefDirElement1.
ELinkPos;
18031 ExitLinkPos = PrefDirElement1.
XLinkPos;
18032 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
18033 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
18036 RouteNumber = Route2MultiMapIterator->second.first;
18040 return(AutoSigsRoute);
18045 return(NotAutoSigsRoute);
18050 RouteNumber = Route2MultiMapIterator->second.first;
18054 return(AutoSigsRoute);
18059 return(NotAutoSigsRoute);
18063 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18065 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18066 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18068 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
18069 EntryLinkPos = PrefDirElement2.
ELinkPos;
18070 ExitLinkPos = PrefDirElement2.
XLinkPos;
18071 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
18072 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
18075 RouteNumber = ItPair.first->second.first;
18079 return(AutoSigsRoute);
18084 return(NotAutoSigsRoute);
18089 RouteNumber = ItPair.first->second.first;
18093 return(AutoSigsRoute);
18098 return(NotAutoSigsRoute);
18102 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
18103 EntryLinkPos = PrefDirElement3.
ELinkPos;
18104 ExitLinkPos = PrefDirElement3.
XLinkPos;
18105 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
18106 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
18109 RouteNumber = ItPair.second->second.first;
18113 return(AutoSigsRoute);
18118 return(NotAutoSigsRoute);
18123 RouteNumber = ItPair.second->second.first;
18127 return(AutoSigsRoute);
18132 return(NotAutoSigsRoute);
18154 EmptyRoute.
RouteID = NextRouteID;
18157 AllRoutesVector.push_back(EmptyRoute);
18158 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18183 AllRoutesVector.push_back(EmptyRoute);
18184 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18207 THVPair Route2MultiMapKeyPair;
18216 LockedRouteTruncateTrackVectorPosition = 0;
18217 LockedRouteLastTrackVectorPosition = 0;
18218 LockedRouteLastXLinkPos = 0;
18219 LockedRouteLockStartTime = TDateTime(0);
18220 if(!LockedRouteVector.empty())
18224 if(LRVIT->RouteNumber == RouteNumber)
18226 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
18227 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
18228 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
18229 LockedRouteLockStartTime = LRVIT->LockStartTime;
18230 LockedRouteFoundDuringRouteBuilding =
true;
18231 LockedRouteVector.erase(LRVIT);
18256 AnsiString(VLoc) +
"," + AnsiString(ELink));
18259 ReturnPair.first = -1;
18260 ReturnPair.second = 0;
18261 THVPair Route2MultiMapKeyPair;
18263 Route2MultiMapKeyPair.first = HLoc;
18264 Route2MultiMapKeyPair.second = VLoc;
18267 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18268 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18270 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18271 Route2MultiMapIterator = ItPair.first;
18273 if(ItPair.first == ItPair.second)
18275 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
18277 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
18279 ReturnPair.first = ItPair.first->second.first;
18280 ReturnPair.second = ItPair.first->second.second;
18281 Route2MultiMapIterator = ItPair.first;
18283 return(ReturnPair);
18286 if(ItPair.first == ItPair.second)
18288 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
18290 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
18292 ReturnPair.first = ItPair.first->second.first;
18293 ReturnPair.second = ItPair.first->second.second;
18294 Route2MultiMapIterator = ItPair.first;
18296 return(ReturnPair);
18299 return(ReturnPair);
18314 AnsiString(VLoc) +
"," + AnsiString(ELink));
18315 THVPair Route2MultiMapKeyPair;
18317 Route2MultiMapKeyPair.first = HLoc;
18318 Route2MultiMapKeyPair.second = VLoc;
18319 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18321 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18323 if(ItPair.first == ItPair.second)
18329 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18331 RouteNumber = ItPair.first->second.first;
18337 if(ItPair.first == ItPair.second)
18343 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
18345 RouteNumber = ItPair.first->second.first;
18366 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
18367 THVPair Route2MultiMapKeyPair;
18369 Route2MultiMapKeyPair.first = HLoc;
18370 Route2MultiMapKeyPair.second = VLoc;
18373 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18376 RouteElementPair.first = RouteNumber;
18377 RouteElementPair.second = RouteElementNumber;
18378 Route2MultiMapEntry.second = RouteElementPair;
18380 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
18383 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
18384 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
18387 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
18388 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
18390 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18392 Route2MultiMap.insert(Route2MultiMapEntry);
18397 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18402 Route2MultiMap.insert(Route2MultiMapEntry);
18420 TempPair.first = -1;
18421 TempPair.second = 0;
18422 SecondPair = TempPair;
18424 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
18425 THVPair Route2MultiMapKeyPair;
18427 Route2MultiMapKeyPair.first = HLoc;
18428 Route2MultiMapKeyPair.second = VLoc;
18429 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18434 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18436 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18438 return(Route2MultiMapIterator->second);
18440 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18442 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18443 TempPair = ItRange.first->second;
18444 SecondPair = (--ItRange.second)->second;
18467 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
18468 if(RouteElementPair.first == -1)
18471 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
18472 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
18474 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
18477 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18478 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
18479 (AnsiString)Caller);
18481 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
18484 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18485 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
18486 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
18487 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
18491 unsigned int SizeVal = 0;
18494 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18496 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
18498 if(SizeVal != Route2MultiMap.size())
18500 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
18501 (AnsiString)Caller);
18517 if(!Route2MultiMap.empty())
18519 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18521 if(Route2MultiMapIterator->second.first > RouteNumber)
18523 Route2MultiMapIterator->second.first--;
18540 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
18541 if(!Route2MultiMap.empty())
18543 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18545 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
18547 Route2MultiMapIterator->second.second--;
18566 AnsiString(ELink));
18570 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
18571 if(RequiredRoutePair.first == -1)
18573 throw Exception(
"Failed to find route element in RemoveRouteElement");
18575 Route2MultiMap.erase(Route2MultiMapIterator);
18576 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
18579 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
18600 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
18601 RequiredRoutePair.second)));
18612 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
18620 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
18622 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
18623 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
18624 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
18636 if(!LockedRouteVector.empty())
18640 if(LRVIT->RouteNumber > RequiredRoutePair.first)
18642 LRVIT->RouteNumber--;
18652 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
18654 AutoSigVectorIT->RouteNumber--;
18659 CheckMapAndRoutes(7);
18673 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
18674 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
18675 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
18691 "," + AnsiString(XLinkPos));
18695 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
18696 if(RouteElementPair.first == -1)
18698 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
18700 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
18702 RequiredPair = RouteElementPair;
18703 if(RouteElement.
XLinkPos != XLinkPos)
18705 if(SecondPair.first != -1)
18707 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
18708 RequiredPair = SecondPair;
18709 if(RouteElement.
XLinkPos != XLinkPos)
18711 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
18716 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
18720 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
18740 AnsiString(AccessNumber));
18742 int Attribute = AccessNumber + 1;
18744 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
18748 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
18752 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
18755 x).XLinkPos] !=
End)
18757 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
18760 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
18803 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
18804 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
18805 int RearwardLinkedRouteNumber;
18831 int TrainID, TrainPosition, BehindTrainPosition;
18832 bool FoundTrain =
false, BehindTrain =
false;
18833 for(
int x = RouteStartPosition; x >= 0; x--)
18835 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
18860 if(FoundTrain && (TrainPosition > 1))
18862 for(
int x = TrainPosition; x >= 0; x--)
18867 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
18887 BehindTrain =
true;
18888 BehindTrainPosition = x;
18895 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
18912 AnsiString(RouteTruncatePosition));
18913 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
18914 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
18917 bool ExamineRoute =
true;
18919 while(ExamineRoute)
18921 for(
int x = StartPosition; x >= 0; x--)
18963 if(SignalCount >= 3)
18982 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
18983 ExamineRoute =
true;
18984 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
19019 ExamineRoute =
false;
19034 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
19037 PrefDirElement = InternalPrefDirElement;
19038 if(LockedRouteVector.empty())
19045 bool InLockedRoute =
false;
19049 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
19053 InLockedRoute =
true;
19062 int RouteNumber, VectorCount = 0;
19067 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
19068 if(RouteType == NoRoute)
19074 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
19077 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
19079 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
19081 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
19082 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
19086 PrefDirElement = InternalPrefDirElement;
19087 LockedVectorNumber = VectorCount;
19092 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
19096 PrefDirElement = InternalPrefDirElement;
19097 LockedVectorNumber = VectorCount;
19118 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19120 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
19126 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
19136 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19138 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
19153 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19155 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
19158 return(GetFixedRouteAt(159, x));
19161 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19169 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19171 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
19174 return(GetModifiableRouteAt(15, x));
19177 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19187 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19189 TOneRoute OneRoute = GetFixedRouteAt(165, x);
19201 int NumberOfRoutes;
19205 for(
int x = 0; x < NumberOfRoutes; x++)
19212 StoreOneRouteAfterSessionLoad(0, &OneRoute);
19230 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
19237 if((NextID < 0) || (NextID > 1000000))
19242 for(
int x = 0; x < NumberOfRoutes; x++)
19267 AnsiString(StartPosition));
19268 if(EndPosition == StartPosition)
19274 int TVPos = EndPosition;
19275 int LkPos = EndXLinkPos;
19277 while(TrackIsInARoute(15, TVPos, LkPos))
19304 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19313 if((NewLkPos == 0) || (NewLkPos == 2))
19333 if(TVPos == StartPosition)
19365 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
19370 if(FirstPair.first > -1)
19373 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19378 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19384 if(SecondPair.first > -1)
19387 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19392 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19398 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
19405 if(FirstPair.first > -1)
19408 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19413 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19419 if(SecondPair.first > -1)
19422 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19427 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19433 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
19440 if(FirstPair.first > -1)
19443 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19448 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19454 if(SecondPair.first > -1)
19457 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19462 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19468 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
19475 if(FirstPair.first > -1)
19478 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19483 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19489 if(SecondPair.first > -1)
19492 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19497 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19503 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
19527 "," + AnsiString(DiagonalLinkNumber));
19532 if(FirstPair.first > -1)
19535 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19540 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19546 if(SecondPair.first > -1)
19549 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19554 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19561 if(FirstPair.first > -1)
19564 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19569 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19575 if(SecondPair.first > -1)
19578 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19583 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19590 if(FirstPair.first > -1)
19593 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19598 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19604 if(SecondPair.first > -1)
19607 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19612 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19619 if(FirstPair.first > -1)
19622 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19627 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19633 if(SecondPair.first > -1)
19636 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19641 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))